<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>CSS3DRenderer - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">CSS3DRenderer</h1>
		<section>
			<header>
				<div class="class-description"><p>This renderer can be used to apply hierarchical 3D transformations to DOM elements
via the CSS3 <a href="https://www.w3schools.com/cssref/css3_pr_transform.asp" target="_blank" rel="noopener">transform</a> property.
<code>CSS3DRenderer</code> is particularly interesting if you want to apply 3D effects to a website without
canvas based rendering. It can also be used in order to combine DOM elements with WebGLcontent.</p>
<p>There are, however, some important limitations:</p>
<ul>
<li>It's not possible to use the material system of <em>three.js</em>.</li>
<li>It's also not possible to use geometries.</li>
<li>The renderer only supports 100% browser and display zoom.</li>
</ul>
<p>So <code>CSS3DRenderer</code> is just focused on ordinary DOM elements. These elements are wrapped into special
3D objects (<a href="CSS3DObject.html">CSS3DObject</a> or <a href="CSS3DSprite.html">CSS3DSprite</a>) and then added to the scene graph.</p></div>
			</header>
			<article>
				<h2 class="subsection-title">Import</h2>
				<p><span translate="no">CSS3DRenderer</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
				<pre><code class="language-js">import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js';</code></pre>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="CSS3DRenderer" translate="no">new <a href="#CSS3DRenderer">CSS3DRenderer</a><span class="signature">( parameters : <span class="param-type"><a href="CSS3DRenderer.html#~Parameters">CSS3DRenderer~Parameters</a></span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new CSS3D renderer.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>parameters</strong>
									</td>
									<td class="description last">
										<p>The parameters.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="domElement" translate="no">.<a href="#domElement">domElement</a><span class="type-signature"> : HTMLElement</span> </h3>
					<div class="description">
						<p>The DOM where the renderer appends its child-elements.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="getSize" translate="no">.<a href="#getSize">getSize</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns an object containing the width and height of the renderer.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The size of the renderer.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Renders the given scene using the given camera.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>scene</strong>
									</td>
									<td class="description last">
										<p>A scene or any other type of 3D object.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>camera</strong>
									</td>
									<td class="description last">
										<p>The camera.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Resizes the renderer to the given width and height.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>width</strong>
									</td>
									<td class="description last">
										<p>The width of the renderer.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>height</strong>
									</td>
									<td class="description last">
										<p>The height of the renderer.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				<h2 class="subsection-title">Type Definitions</h2>
				<div class="member">
					<h3 class="name" id="~Parameters" translate="no">.<a href="#~Parameters">Parameters</a> </h3>
					<div class="description">
						<p>Constructor parameters of <code>CSS3DRenderer</code>.</p>
					</div>
<table class="props">
	<tbody>
		<tr>
				<td class="name">
					<strong>element</strong>
						<br>
<span class="param-type">HTMLElement</span>
				</td>
			<td class="description last">
				<p>A DOM element where the renderer appends its child-elements.
If not passed in here, a new div element will be created.</p>
			</td>
		</tr>
	</tbody>
</table>
				</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS3DRenderer.js" translate="no" target="_blank" rel="noopener">examples/jsm/renderers/CSS3DRenderer.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>